Opening the INF File

You must use the SetupOpenInfFile1UU.WA function to open the INF file before you can retrieve information from it, or append other INF files to it.

The following example opens an INF file.

HINF MyInf;                //variable to hold the INF handle

PUINT ErrorLine;           //variable to point to errors returned

BOOL test;                 //variable to receive function success

 

MyInf = SetupOpenInfFile (

      szInfFileName,       //the filename of the inf file to open

      NULL,                //optional class information

      INF_STYLE_WIN4,      //the inf style

      ErrorLine            //line number of the syntax error

);

 

In the preceding example, MyInf is the handle returned by SetupOpenInfFile to the opened INF file. The parameter szInfFileName specifies the name of the INF file to open. The INF class is specified as NULL. This indicates that the Class key should be ignored. The INF_STYLE_WIN4 value specifies that the INF file is formatted in the INF format used with Windows 95 and Windows NT 4.0. The ErrorLine parameter is a pointer to a variable that receives the line number of an error that the SetupOpenInfFile function generates.

After an INF file is opened, you can call the SetupOpenAppendInfFile132.P6I function to append a file to the open INF file. To append several files, repeat this process.

If you call the SetupOpenAppendInfFile function and the filename passed to it is NULL, then the function will search the Version1_NXEGQ section of the open INF file (and any appended INF files) for a LayoutFile key. If the function finds a key, it will append the file specified by that key (usually LAYOUT.INF). When multiple INF files have been combined, SetupOpenAppendInfFile starts with the last appended INF file when it searches for a Version section.

The following example appends the szSecondInfFileName file to the open file, szInfFileName.

test = SetupOpenAppendInfFile (

      szSecondInfFileName,    //name of the inf file to append
                              //to the open inf file, if NULL,
                              //the fn searches for the LayoutInf
                              //key in the version section, and
                              //appends the file specified there.

      MyInf,                  //handle of the open inf file

      ErrorLine               //pointer to an unsigned integer that
                              //receives error information

);

 

In the example, szSecondInfFileName is the name of the file to append to the open INF file. MyInf is the handle to the open INF file returned by the previous call to the SetupOpenInfFile function. The parameter ErrorLine points to a variable that will receive any error information generated by the SetupOpenAppendInfFile function.